package com.pan.analyzer;

import com.pan.util.PrintUtil;
import lombok.extern.slf4j.Slf4j;
import org.apdplat.word.WordSegmenter;
import org.apdplat.word.segmentation.Word;

import java.util.Iterator;
import java.util.List;
import java.util.Map;


@Slf4j
public class WordAnalyzer implements Analyzer {
    @Override
    public Map<String, Integer> getWordCount(List<String> sentences) {

        Iterator<String> iterator = sentences.iterator();
        while(iterator.hasNext()){
            String sentence = iterator.next();
            List<Word> words = WordSegmenter.seg(sentence);
      words.forEach(
          x -> {
            System.out.println(x.getText());
          });

        }

        // 移除停用词进行分词
        // List<Word> list = WordSegmenter.seg(words);
        // 保留停用词
        return  null;
    }
}
